Focus detection apparatus and method for controlling the same

ABSTRACT

In a focus detection apparatus having a plurality of filters suitable for processing of signals having different frequencies, a setting unit sets a thinning rate in a main-scanning direction of an image sensor depending on a filter to be used, a control unit controls to read image signals sequentially with the set thinning rate and store the read image signals in a storage unit, a processing unit processes the stored image signals with the filter and obtains a focus state evaluation value in a sub-scanning direction of the image sensor and a focus control unit performs the focus control processing based on the focus state evaluation value. If the filter to be used is for a second frequency that is higher than a first frequency, the setting unit sets a lower thinning rate than that for a filter for the first frequency.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a focus detection apparatus and amethod for controlling the same, and in particular to a focus detectionapparatus that performs focus control using an image signal obtained byan image sensor for capturing an image, and a method for controlling thesame.

2. Description of the Related Art

In Digital cameras and video cameras, a contrast detection autofocus(referred to hereinafter as AF) method is typically employed thatdetects signals corresponding to contrast evaluation values of asubject, using output signals of an image sensor such as a CCD or CMOSsensor, and brings the subject into focus. In this method, the contrastevaluation values of the subject are sequentially detected while a focuslens is moved over a predetermined movement range in a direction of anoptical axis (AF scanning operation), and a focus lens position havingthe highest contrast evaluation value is detected as an in-focusposition.

Furthermore, focus detection apparatuses are known that store outputsignals from an image sensor in an internal memory (SDRAM), and obtain acontrast evaluation value between the stored output signals in themain-scanning direction and the sub-scanning direction of the imagesensor, thereby performing more accurate focus control. Since themain-scanning direction of the image sensor is typically the horizontaldirection and the sub-scanning direction is typically the verticaldirection, contrast evaluation in the sub-scanning direction, or thevertical direction, requires memory capacity that can sufficientlyrecord signals (sensor signals) of a plurality of lines from the imagesensor.

Japanese Patent Laid-Open No. 8-317272 discloses a method for storingsensor signals in a state in which they are summed up in the horizontaldirection (main-scanning direction), in order to reduce memory capacitywhen performing contrast evaluation in the vertical direction. Sensorsignals of a single line are reduced to a summed signal that is afraction of the sensor signals, and thus it is possible to realize focusstate detection in the vertical direction (sub-scanning direction) withsmall memory capacity.

Japanese Patent Laid-Open No. 2008-199477 discloses a method thatchanges a thinning rate according to a focus state level, in order toreduce a calculation cost of focus state detection. High accuracy focusstate detection is possible by increasing the thinning rate when animage is significantly blurred, and decreasing the thinning rate in thevicinity of an in-focus position.

However, in the conventional technique disclosed in Japanese PatentLaid-Open No. 8-317272, sensor signals in the main-scanning directionare summed with a constant adding rate to perform focus state detectionin the vertical direction, irrespective to the focus state level, whichmay cause deterioration in accuracy in the focus state detection. Forexample, if an adding rate is increased in the vicinity of an in-focusposition, focus state detection is performed in a state in which ahigh-frequency component is lost, resulting in focus state detectionthat does not have sufficiently high accuracy.

On the other hand, although the conventional technique disclosed inJapanese Patent Laid-Open No. 2008-199477 relates to the method thatchanges a thinning rate of a sensor signal according to the focus statelevel of a subject, no filtering processing at the time of obtaining acontrast evaluation value is disclosed. Nor is contrast evaluation inthe sub-scanning direction disclosed. For example, in Japanese PatentLaid-Open No. 2008-199477, if an image is largely blurred, the focusstate level is determined to be low and a thinning rate is set to alarge value. In this case, evaluation that is performed using a signalthat has passed through a high frequency band-pass filter may result infocus state detection that does not have sufficiently high accuracy.

SUMMARY OF THE INVENTION

The present invention has been made in consideration of the abovesituation, and realizes to perform high accuracy focus state detectionboth in the main-scanning direction and the sub-scanning direction of animage sensor using image signals obtained from the image sensor.

According to the present invention, provided is a focus detectionapparatus comprising: a plurality of filters respectively suitable forprocessing of signals having different frequencies for obtaining a focusstate evaluation value in a sub-scanning direction of an image sensorthat has a plurality of pixels arranged two-dimensionally; a settingunit configured to set a thinning rate in a main-scanning direction ofthe image sensor depending on a filter to be used, of the plurality offilters; a control unit configured to perform control such that imagesignals are sequentially read with the thinning rate set by the settingunit from a detection area, on which focus control processing isperformed, of areas of the plurality of pixels and are stored in astorage unit; a processing unit configured to process, each time imagesignals of the number of lines required for the processing by the filterto be used are stored in the storage unit, the stored image signals withthe filter to be used and obtain a focus state evaluation value; and afocus control unit configured to perform the focus control processingbased on the focus state evaluation value obtained by the processingunit, wherein, if the filter to be used is suitable for processing of asignal having a second frequency that is higher than a first frequency,the setting unit sets a thinning rate that is lower than that in thecase where the filter is suitable for processing of a signal having thefirst frequency.

Furthermore, according to the present invention, provided is a methodfor controlling a focus detection apparatus that is provided with animage sensor having a plurality of pixels arranged two-dimensionally,and a plurality of filters respectively suitable for processing ofsignals having different frequencies for obtaining a focus stateevaluation value in a sub-scanning direction of the image sensor, themethod comprising: a setting step of setting a thinning rate in amain-scanning direction of the image sensor depending on the filter tobe used, of the plurality of filters; a reading step of sequentiallyreading, with the thinning rate set in the setting step, image signalsfrom a detection area, on which focus control processing is performed,of areas of the plurality of pixels, and storing the read image signalsin a storage unit; a processing step of processing, each time imagesignals of the number of lines required for the processing by the filterto be used are stored in the storage unit, the stored image signals withthe filter to be used and obtaining a focus state evaluation value; anda focus control processing step of performing the focus controlprocessing based on the focus state evaluation value obtained in theprocessing step, wherein, if the filter to be used is suitable forprocessing of a signal having a second frequency that is higher than afirst frequency, the setting step sets a thinning rate that is lowerthan that in the case where the filter is suitable for processing of asignal having the first frequency.

Further, according to the present invention, provided is a focusdetection apparatus comprising: a control unit configured to performcontrol such that image signals are sampled for each line of an imagesensor and are sequentially stored in a storage unit, the image sensorhaving a plurality of pixels arranged two-dimensionally; a plurality offilters respectively suitable for processing of signals having differentfrequencies for obtaining a focus state evaluation value; a selectionunit configured to select a filter to be used, from among the pluralityof filters; and a processing unit configured to process the stored imagesignals with the selected filter, wherein the number of sampling of theimage signals in the line that are to be stored in the storage unitvaries depending on the selected filter.

Further, according to the present invention, provided is a focusdetection method, comprising: a control step of performing control suchthat image signals are sampled for each line of an image sensor, and aresequentially stored in a storage unit, the image sensor having aplurality of pixels arranged two-dimensionally; a selection step ofselecting a filter to be used, from among a plurality of filtersrespectively suitable for processing of signals having differentfrequencies for obtaining a focus state evaluation value; and aprocessing step of processing the stored image signals with the selectedfilter, wherein the number of sampling of the image signals in the linethat are to be stored in the storage unit varies depending on theselected filter.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments (with reference to theattached drawings).

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate embodiments of the invention, andtogether with the description, serve to explain the principles of theinvention.

FIG. 1 is a block diagram illustrating a schematic configuration of animage capturing apparatus according to a first embodiment;

FIG. 2 is a flowchart illustrating AF operation procedures according tothe first embodiment;

FIG. 3 is a diagram illustrating an example of an AF frame according tothe first embodiment;

FIG. 4 is a diagram illustrating a thinning rate according to the firstembodiment;

FIG. 5 is a diagram illustrating a concept of a combination of a focusstate level, a filter, and a thinning rate according to the firstembodiment;

FIG. 6 is a diagram illustrating an example of focus state determinationaccording to the first embodiment;

FIGS. 7A and 7B are diagrams illustrating concepts of pixels of an imagesensor that are read in the different focus state levels according tothe first embodiment;

FIG. 8 is a flowchart illustrating AF operation procedures according toa second embodiment; and

FIGS. 9A to 9D are diagrams for explaining a memory 8.

DESCRIPTION OF THE EMBODIMENTS

Exemplary embodiments of the present invention will be described indetail in accordance with the accompanying drawings.

First Embodiment

A first embodiment of the present invention will be described in detailwith reference to FIGS. 1 to 6. FIG. 1 is a block diagram illustrating aschematic configuration of an image capturing apparatus including afocus detection apparatus, according to the first embodiment of thepresent invention.

In FIG. 1, an image capturing apparatus 1 includes, for example, adigital still camera, a digital video camera, or the like. A zoom lensgroup 2 and a focus lens group 3 constitute an imaging optical system. Adiaphragm 4 controls the amount of light flux that passes through theimaging optical system. The zoom lens group 2, the focus lens group 3,and the diaphragm 4 are formed in the lens barrel 31.

An image sensor 5 is a sensor, represented by a CCD or CMOS sensor forexample, that has a plurality of pixels arranged two-dimensionally andphotoelectrically converts an image of a subject that is formed bypassing through the imaging optical system. An image capture circuit 6receives an electric signal that was photoelectrically converted by theimage sensor 5, and subjects the received electric signal to varioustypes of image processing, thereby generating a predetermined imagesignal. An A/D conversion circuit 7 converts an analog image signalgenerated by the image capture circuit 6 to a digital image signal.

A memory 8 is a buffer memory or the like that temporarily stores thedigital image signal output from the A/D conversion circuit 7, and isconstituted by a SDRAM, for example. An image signal output from a partof an imaging region of the image sensor 5 is stored in the memory 8,and the image signal stored in the memory 8 is read to a scan AFprocessing circuit 14, which will be described later, via a MPU 15, andcan perform focus state detection.

A D/A conversion circuit 9 reads the image signal stored in the memory8, and converts it into an analog signal and into an image signalsuitable for being output for reproduction. An image display apparatus10 is a liquid crystal display apparatus (LCD) or the like that displaysthe image signal converted by the D/A conversion circuit 9. Acompression and decompression circuit 11 reads the image signaltemporarily stored in the memory 8, and subjects the read image signalto compression processing or encoding processing to convert it intoimage data having a format that is suitable for the image data beingstored in a storage memory 12. The storage memory 12 stores the imagedata processed by the compression and decompression circuit 11.Furthermore, the compression and decompression circuit 11 reads theimage data stored in the storage memory 12 and subjects the read imagedata to decompression processing or decoding processing to convert itinto image data having a format that is most suitable for the image databeing reproduced and displayed.

Various types of memory may be used as the storage memory 12. Thestorage memory 12 may be, for example, a semiconductor memory such as aflash memory that is in the shape of a card or a stick detachable fromthe apparatus, or a magnetic storage medium such as a hard disk or aflexible disk.

An AE processing circuit 13 performs automatic exposure (AE) processingusing an image signal output from the A/D conversion circuit 7.Furthermore, the scan AF processing circuit 14 performs autofocus (AF)processing using an image signal output from the A/D conversion circuit7.

The MPU 15 controls the constituent components of the image capturingapparatus 1, and includes a computational memory. A timing generator(TG) 16 generates a predetermined timing signal. The reference numerals17 denotes a CCD driver that drives the image sensor 5 based on thetiming signal from the TG 16.

A first motor drive circuit 18 drives the diaphragm 4 by driving adiaphragm driving motor 21 based on control of the MPU 15. A secondmotor drive circuit 19 drives the focus lens group 3 by driving a focusdrive motor 22 based on control of the MPU 15. Furthermore, a thirdmotor drive circuit 20 drives the zoom lens group 2 by driving a zoomdrive motor 23 based on control of the MPU 15.

An operation switch 24 is constituted by various types of switches thatinclude, for example, a master electrical switch, a release switch forstarting imaging operation or the like, a reproduction switch, a zoomswitch, a switch for turning on/off display of an AF evaluation valuesignal on a monitor, and the like. The master electrical switch is aswitch for activating the image capturing apparatus 1 and supplyingpower to the image capturing apparatus 1. Furthermore, the releaseswitch is constituted by a two-stage switch that is operated by a firststroke for generating an instruction signal that instructs AE processingand AF processing that are performed prior to the imaging operation, anda second stroke for generating an instruction signal that instructsstarting of the actual exposure operation. The reproduction switchstarts a reproduction operation, and the zoom switch moves the zoom lensgroup 2 of the imaging optical system so that the zoom lens group 2performs zooming.

An EEPROM 25 is a read-only memory that is electrically rewritable, andhas stored in advance therein programs for executing various types ofcontrol, data for use in the various types of operations, and the like.The reference numeral 26 denotes a battery, the reference numeral 28denotes a flash light emitting unit, the reference numeral 27 denotes aswitching circuit for controlling flash light emission of the flashlight emitting unit 28, and the reference numeral 29 denotes a displayelement such as a LED for displaying OK/NG of the AF operation.

Hereinafter, a focusing operation (AF operation) of the image capturingapparatus 1 having the above-described configuration according to thefirst embodiment will be described with reference to FIG. 2. FIG. 2 is aflowchart illustrating procedures of the AF operation of the imagecapturing apparatus 1. A control program with respect to this operationis executed by the MPU 15.

After the start of AF operation, the MPU 15 first sets, in step S1, anAF frame. In this processing, as shown in FIG. 3, the position and sizeof an AF frame 301 that indicates a detection area on which focuscontrol processing is performed are set with respect to the entire imagearea. The position and size of the AF frame 301 can suitably bedetermined manually or automatically according to the image capturingmode. FIG. 3 is a diagram illustrating an example in which the AF frame301 is set for a human face in the face detection mode. The MPU 15records the row count R, the column count C, and the position (x, y) ofthe AF frame 301 at that time. Note that the coordinates of anothercorner or the center of the AF frame 301, for example, may be set as theposition of the AF frame 301.

In step S2, the focus lens group 3 moves its position (referred tohereinafter as “focus lens position”) n to a scan starting position(n=0), in order to start AF scanning (focus state detection operation)of the AF frame 301 set in step S1. In step S3, image signals of pixelsin the AF frame 301 are sequentially read at the focus lens position nto which the focus lens group 3 has moved, a focus state evaluationvalue E[n] is obtained in the scan AF processing circuit 14 by awell-known method, and the obtained focus state evaluation value E[n] isstored in the MPU 15. Furthermore, a focus state level is computed usingthe obtained focus state evaluation value E[n]. “Focus state level” usedin the present first embodiment is a parameter whose value is largerwith an increase in a degree of in-focus, and “the focus state level ishigh” when the image is in-focus, and “the focus state level is low”when the image is blurred. Here, a focus state level F[n] is, forexample, a ratio between a focus state evaluation value E[n] in themain-scanning direction and a luminance signal differential value D[n](luminance signal maximum value in the AF frame−luminance signal minimumvalue in the AF frame) at the focus lens position n. That is, the focusstate level F[n] can be expressed in the following formula (1):

F[n]=E[n]/D[n]  (1)

In step S4, a filter is selected based on the focus state level obtainedin step S3. Because the value of the focus state level F[n] in thein-focus state can be estimated in a setting condition, it is possibleto determine how much the image is blurred based on the value of thefocus state level F[n]. For example, it is determined that the focusstate level is low when the value of the focus state level F[n] is athreshold or less, and the focus state level is high when the value ofthe focus state level F[n] exceeds the threshold. This determination ofthe focus state level may be performed in a binary manner, or in astep-wise manner according to the focus state level of each focus lensposition.

Typically, if it is determined that the focus state level is low, a lowfrequency band-pass filter is selected that is suitable for processingof a lower frequency signal and has a variation in the evaluation valueeven if the image is significantly blurred. Whereas, if it is determinedthat the focus state level is high, a high frequency band-pass filter isselected that is suitable for processing of a higher frequency signaland has a large variation in the evaluation value in the vicinity of thein-focus position. Upon selection of a filter, a tap count T of thefilter is determined. Typically, the tap count T of a high frequencyband-pass filter is low, and the tap count T of a low frequencyband-pass filter is high. The first embodiment intends to perform focusstate evaluation in the vertical direction (sub-scanning direction) withrespect to the main-scanning direction of the image sensor 5. Therefore,for the AF operation, the memory 8 needs at minimum a memory capacity tostore the product obtained by the tap count T of the filter×the columncount C (pixel count in the main-scanning direction) of the AF frame,which will be described later.

Then, in step S5, a thinning rate is set based on the tap count Tselected in step S4, that is, the number of lines required forprocessing using the filter. FIG. 4 is a diagram illustrating a thinningrate in the first embodiment, and shows areas in the AF frame 301 in thecase where the thinning rate of the image sensor 5 in the main-scanningdirection is set to ⅓. In FIG. 4, each square frame denotes a singlepixel (i, j), in which white pixels are pixels that are to be read, andshaded pixels are pixels that are not to be read. If the main-scanningdirection is the row direction, thinning out is performed in themain-scanning direction, and thus reading is performed such that, forexample, (1, 1), (1, 4), (1, 7), . . . , (1, C), (2, 1) (2, 4), (2, 7),. . . , (R, C). Furthermore, if thinning out is performed in the rowdirection such that, for example, (1, 1), (1, 7), . . . , (1, C) areread, this means that the thinning rate is ⅙, and in the presentembodiment, it is expressed that the thinning rate ⅙ is “higher” thanthe thinning rate ⅓.

When the focus state level is higher, focus state detection with higheraccuracy is necessary but only a low number of rows need to be read dueto the reduced tap count of the filter, and it is possible to set a lowthinning rate. In contrast, when the focus state level is low, a largernumber of rows need to be read, and it is necessary to set a highthinning rate. 1/T may be selected as the thinning rate 1/Z, or thethinning rate may be obtained by the formula M/(T×R×C) where M is thememory capacity. The concept of combinations of the filter and thethinning rate depending on the focus state levels are summarized andshown in the table of FIG. 5.

Then, in step S6, a variable m is initialized to 1. Then, in step S7, iof (i, j) indicating the coordinates of a pixel in the AF frame 301 isset to the variable m, and in step S8, it is determined whether or not iis the last row for obtaining image signals of the tap count T of thefilter starting from the m-th row (that is, it is determined whether ornot i=m+T−1). In the example of FIG. 4, in the case where m=1 and thetap count T=3, it is determined whether or not i is the third row. If itis determined that i is the last row for obtaining image signals of thetap count T, the procedure advances to step S14, and otherwise to stepS9.

In step S9, j of (i, j) indicating the coordinates of a pixel in the AFframe 301 is initialized to 1, and in step S10, an image signal is readfrom the pixel (i, j) and is stored in the memory 8. In step S11, it isdetermined whether or not j has reached the last column C (whether ornot j<C). If it is determined that j has not reached the last column C,in step S12, the inverse number Z of the thinning rate selected in stepS5 is added to j, the reading position is shifted by Z pixels, andthereby pixels are thinned out. Then, the procedure returns to step S10,where the processing in which an image signal is read from the pixel (i,j) and is stored in the memory 8 is repeated. For example, in the casewhere the thinning rate is ⅓, 3 is added to j, and thereby signals ofpixels in the third column from here are read in the next routine. If itis determined, in step S11, that j has reached the last column C, instep S13, the row that is to be read is shifted to the next row (i=i+1),and the procedure returns to step S8.

With reference to the example of FIG. 4, the next image signal is readby performing the processing in the above-described steps S7 to S13. Inthe case where, for example, the variable m=1, the filter tap count T=3,and the thinning rate 1/Z=⅓, the white pixels (1, 1), (1, 4), . . . ,(1, C), (2, 1), (2, 4), . . . , (2, C) enclosed in heavy lines are readand stored in the memory 8. Furthermore, in the case where the variablem=2, the pixels (2, 1), (2, 4), . . . , (2, C), (3, 1), (3, 4), . . . ,(3, C) are read and stored in the memory 8.

If it is determined in step S8 that the row i that is to be read is thelast row for obtaining image signals for the tap count T, the procedureadvances to step S14, where j is initialized to 1, and in step S15, animage signal is read from the pixel (i, j) and stored in the memory 8.With this reading out, all pieces of data for computing a contrastevaluation value Ev_m[j] (focus state evaluation value) in thesub-scanning direction of the j-th column have been stored in the memory8. Accordingly, in step S16, the contrast evaluation value Ev_m[j] ofthe j-th column is computed using the filter set in step S4. In the casewhere, for example, m=1 and j=1, in the pixel arrangement shown in FIG.4, the computing is performed using:

Ev_(—)1[1]=(1,1)*tap_(—)1+(2,1)*tap_(—)2+(3,1)*tap_(—)3  (2),

where, in the above-described formula (2), (1, 1), (2, 1), and (3, 1)denote image signals read from the pixels of the correspondingcoordinates, and tap_(—)1, tap_(—)2 and tap_(—)3 denote filtercoefficients.

In step S17, it is determined whether or not the variable m is 2 ormore, and if it is determined that the variable m is less than 2, theprocedure advances to step S19, where the contrast evaluation valueEv_m[j] computed in step S16 is maintained as a contrast evaluationvalue Ev[j] of the j-th column at the current focus lens position n.

On the other hand, if it is determined that the variable m is 2 or more,in step S18, the computed contrast evaluation value Ev_m[j] is comparedwith a previously stored contrast evaluation value Ev[j]. If thecomputed contrast evaluation value Ev_m[j] is larger than the previouslystored contrast evaluation value Ev[j], the contrast evaluation valueEv_m[j] is maintained in step S19 as the contrast evaluation valueEv[j]. If the computed contrast evaluation value Ev_m[j] is not largerthan the previously stored contrast evaluation value Ev[j], theprocedure advances to step S20 without changing the contrast evaluationvalue Ev[j]. With this, the maximum contrast evaluation value of eachcolumn is maintained as Ev[j].

In step S20, similar to step S11, it is determined whether or not j hasreached the last column C, and if it is determined that j has notreached the last column C, j is changed, in step S21, to the next columnto be read, and the procedure returns to step S15, where theabove-described processing is repeated. On the other hand, if it isdetermined that j has reached the last column C, the variable m isincremented by 1 in step S22, and it is determined, in step S23, whetheror not the row required for processing using the incremented variable mis included in the AF frame 301, that is, whether or not m≦R−T+1. If itis determined that the row is included, the procedure returns to stepS7, where the above-described processing is repeated.

On the other hand, if the row required for processing using the variablem is not included in the AF frame 301, this means that processing on allthe areas of the AF frame 301 has been completed. Therefore, in stepS24, all the contrast evaluation values Ev[j] of the columns areintegrated to obtain a contrast evaluation value Ev[n] in thesub-scanning direction at the focus lens position n. Note that theobtained contrast evaluation value Ev[n] gets larger as the in-focusstate gets nearer.

Then, the focus lens position n is set to the next position, that is, instep S25, it is determined whether or not the current focus lensposition n is at a driving end position LPend in a drive range of thefocus lens group 3. If it is determined that the current focus lensposition n is not at LPend, the focus lens position n is shifted to thenext position in step S26, and the procedure returns to step S3, and acontrast evaluation value Ev[n] in the sub-scanning direction at thenext focus lens position n is obtained using the above-describedprocedures. If it is determined that the current focus lens position nis at LPend, the procedure advances to step S27, where focus statedetermination is performed.

FIG. 6 shows an example of focus state determination based on a contrastevaluation value Ev. As with in FIG. 6, the focus lens position n variesfrom LP1 to LP4, and the contrast evaluation values Ev[n] at respectivefocus lens positions n are shown by Ev[LP1] to Ev[LP4]. It is clearthat, since the contrast evaluation value Ev[LP3] is the largest valuein the example, the focus lens position LP3 is the position that isclosest to the in-focus state.

In step S28, the MPU 15 determines whether or not focusing is possible.For example, when the contrast evaluation value Ev[n] has one peak valueas shown in FIG. 6, it is determined that focusing is possible, but whenthe contrast evaluation value Ev[n] has two or more peak values, or whenthe contrast evaluation value Ev[n] does not have a peak value, it isdetermined that focusing is not possible. If it is determined thatfocusing is possible, the MPU 15 obtains, in step S29, a peak position(max(Ev[n])) based on the contrast evaluation value Ev[n], and drivesthe focus lens group 3 to the obtained peak position. In the exampleshown in FIG. 6, the focus lens group 3 is driven to the focus lensposition LP3. Then, in step S30, the MPU 15 displays that the image isin-focus, and the AF operation ends.

On the other hand, if it is determined in step S28 that focusing is notpossible, the MPU 15 drives, in step S31, the focus lens group 3 to apredetermined position that is referred to as “preset fixed point”, suchas for example a position at which the probability that a subject existsis high. Then, in step S32, the MPU 15 displays that the image is notin-focus, and the AF operation ends.

Hereinafter, pixels that are read in the AF operation will be describedwith reference to FIGS. 7A and 7B. FIG. 7A shows the example in whichthe thinning rate is ⅓, and FIG. 7B shown the example in which thethinning rate is ⅙. As shown in FIG. 5, if it is determined in step S4that the focus state level is high, a high frequency band-pass filterwhose tap count is low and that can evaluate a high-frequency componentis selected and a low thinning rate is set. With this, the range andpixels to be read that are required for computing a contrast evaluationvalue in the sub-scanning direction are as shown in FIG. 7A. On theother hand, if it is determined that the focus state level is low, a lowfrequency band-pass filter whose tap count is high and that can evaluatea low-frequency component is selected and a high thinning rate is set,and the range and pixels to be read that are required for computing acontrast evaluation value in the sub-scanning direction are as shown inFIG. 7B. In other words, in FIG. 7A, since the thinning rate is low, therow count R′_a subjected to reading and storing is low, and in FIG. 7B,since the thinning rate is high, the row count R′_b subjected to readingand storing is higher than R′_a.

As described above, according to the present first embodiment, it ispossible to obtain, with high accuracy, a contrast evaluation value inthe sub-scanning direction, which is perpendicular to the main-scanningdirection, while suppressing the capacity necessary for the memory 8 toa capacity to store the product obtained by the column count C/Z×the tapcount T. That is, high accuracy focus state detection of an image sensoris possible both in the main-scanning direction and in the sub-scanningdirection using image signals obtained from the image sensor, withoutincreasing the memory capacity for use in a focusing operation.

Note that, although the foregoing description was made that, as shown inFIG. 4, thinning out is performed in which image signals that are to beread and image signals that are not to be read are repeated in apredetermined pattern, it is also possible that image signals are summedand read at the same cycle. For example, in the case where the thinningrate is ⅓, a method may be used in which image signals are summed bythree pixels such that (1, 1)+(1, 2)+(1, 3), (1, 4)+(1, 5)+(1, 6), (1,7)+(1, 8)+(1, 9), . . . , and are read and stored in the memory 8.

Furthermore, although the foregoing description was made taking the casewhere each time the variable m is incremented, image signals for T rowsare newly read, it is also possible that, image signals of rows otherthan the first row of previously read image signals may be used inprocessing using the next variable m. Therefore, image signals in thefirst row of the image signals stored in the memory 8 are sequentiallydeleted, and the image signals of a newly read row are stored in thememory 8, thereby making it possible to reduce processing needed forreading out.

Furthermore, a configuration of the memory 8 is preferably as follows.

The configuration of the memory 8 is as shown in FIG. 9A. Information onthe row count R=N that are read in a main scanning direction (thelateral direction in the example of FIG. 9) is first stored in a singleline memory RAM(N). The information stored in each of line memories fromRAM(0) to RAM(R) is then stored in the memory 8. Then, as shown in FIG.9B, one piece of data of the information stored in the memory 8 is readfrom each RAM, and data for each column are transmitted through the AFprocessing circuit 13, thereby enabling smooth contrast evaluation inthe vertical direction.

That is, it is preferable that each single memory RAM secure thecapacity of C/Z. At that time, the capacity of the memory 8 isdetermined by C/Z×R.

As described above, when the memory 8 is constituted by a plurality ofline memories RAM(N), it is preferable that the capacity C/Z of a singleline memory RAM(N) be constituted by Z in the case of the highestthinning rate. This is to realize speeding up by suppressing the numberof pieces of information that is needed to be read at the same time wheninformation (R, C) is given to the AF processing circuit to 1, as shownin FIG. 9B.

FIG. 9C shows another example of the configuration of line memoriesRAM(N). Each RAM(N) of FIG. 9C has the capacity that is twice as largeas that of the RAM(N) shown in FIG. 9A, and the number of the linememories RAM(N) of FIG. 9C is one-half of that of the line memoriesRAM(N) shown in FIG. 9A. Even in this case, the necessary capacity ofthe memory 8 is the same but information for two lines is stored in oneRAM(N), so the processing in the AF processing circuit 13 is as shown inFIG. 9D.

In other words, in the processing in the AF processing circuit 13, twopieces of information need to be read at the same time from a singleline RAM(N), and thus the AF processing may slow down.

As described above, the RAM(N) in the memory 8 may preferably beconfigured to have the capacity C/Z that secures a space for the numberof lines. When the thinning rate Z varies, it is preferable to set C/Z,where Z is the highest thinning rate.

Furthermore, separate memories 8 may be provided for a high frequencyband-pass filter and a low frequency band-pass filter. In this case,although the memory capacity for use in a focusing operation increases,it is possible to store information for each line that is suitable forthe processing in the AF processing circuit 13 in the memory 8.Accordingly, it is possible to perform, using image signals obtainedfrom an image sensor, high accuracy focus state detection both in themain-scanning direction and the sub-scanning direction of the imagesensor.

Second Embodiment

Next, AF operation of the image capturing apparatus 1 according to asecond embodiment of the present invention will be described withreference to FIG. 8. Note that the configuration of the image capturingapparatus 1 is the same as that of the image capturing apparatus 1described in the first embodiment, and thus description thereof isomitted. The main difference from the first embodiment is in the filterselecting method. In the foregoing first embodiment, a filter isselected according to the focus state level obtained at each focus lensposition n. In contrast, in the second embodiment, a filter is selectedaccording to a driving distance of the focus lens position (referredhereinafter to as “sampling interval”) per unit time. In FIG. 8, thesame reference numerals are given to the same processing as thatdescribed with reference to FIG. 2, and description thereof is omittedappropriately.

After an AF frame is set in step S1, a sampling interval is selected instep S101. This sampling interval is changed depending on a scan mode.For example, in the case of a rough scan, in which an in-focus positionis roughly searched for from an infinite position to a near endposition, a wide sampling interval is set. On the other hand, in thecase of a fine scan, in which the vicinity of the in-focus positionfound in the rough scan is more finely searched than in the rough scan,a narrow sampling interval is set. Furthermore, it is also possible todetermine a sampling interval based on the lens driving speed driven bythe focus drive motor 22. Assuming that the frame rate is the same, awide sampling interval may be employed when the driving speed is high,and a narrow sampling interval may be employed when the driving speed islow.

In step S102, a filter is selected based on the sampling intervalselected in step S101. When the sampling interval is wider than apredetermined threshold, a low frequency band-pass filter is selected,and when the sampling interval is the predetermined threshold or less, ahigh frequency band-pass filter is selected. From steps S5 onward, thesame procedures as those in the foregoing first embodiment areperformed.

According to the second embodiment, as described above, the same effectsas those in the first embodiment can be achieved.

Note that descriptions of the foregoing first and second embodimentswere made that the main-scanning direction of the image sensor 5 is thehorizontal direction, but the present invention is not limited to this.For example, the main-scanning direction may be the vertical direction.

Moreover, in the first and second embodiments, the in-focus state of asubject is changed by moving the focus lens group 3, but the method forchanging the in-focus state is not limited to this. For example, themethod may be realized by moving the image sensor 5, instead of thefocus lens group 3, so as to change the distance between the focus lensgroup 3 and the image sensor 5. Furthermore, the change of an in-focusstate may be realized by performing re-configuration processing using animage capturing apparatus 1 that can obtain information on the incidentangle of a light ray (light field information).

The present invention is also applicable to, in addition to theabove-described image capturing apparatus, any apparatus that obtains anelectrical image by photoelectrically converting an incident opticalimage using a solid-state image sensor such as an area sensor in whichimage elements are two-dimensionally arranged.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application Nos.2013-180355, filed on Aug. 30, 2013 and 2014-123820, filed on Jun. 16,2014 which are hereby incorporated by reference herein in theirentirety.

What is claimed is:
 1. A focus detection apparatus comprising: aplurality of filters respectively suitable for processing of signalshaving different frequencies for obtaining a focus state evaluationvalue in a sub-scanning direction of an image sensor that has aplurality of pixels arranged two-dimensionally; a setting unitconfigured to set a thinning rate in a main-scanning direction of theimage sensor depending on a filter to be used, of the plurality offilters; a control unit configured to perform control such that imagesignals are sequentially read with the thinning rate set by the settingunit from a detection area, on which focus control processing isperformed, of areas of the plurality of pixels and are stored in astorage unit; a processing unit configured to process, each time imagesignals of the number of lines required for the processing by the filterto be used are stored in the storage unit, the stored image signals withthe filter to be used and obtain a focus state evaluation value; and afocus control unit configured to perform the focus control processingbased on the focus state evaluation value obtained by the processingunit, wherein, if the filter to be used is suitable for processing of asignal having a second frequency that is higher than a first frequency,the setting unit sets a thinning rate that is lower than that in thecase where the filter is suitable for processing of a signal having thefirst frequency.
 2. The focus detection apparatus according to claim 1,further comprising: a computation unit configured to compute a focusstate level based on an image signal obtained from the detection area;and a selection unit configured to select, when the computed focus statelevel is a second focus state level that is higher than a first focusstate level, a filter that is suitable for processing of a signal havinga higher frequency than that in the case of the first focus state levelas the filter to be used, from among the plurality of filters.
 3. Thefocus detection apparatus according to claim 1, wherein the control unitfurther controls the processing unit, while changing a distance betweena focus lens and the image sensor, so as to obtain a focus stateevaluation value at each distance, the focus detection apparatus furthercomprising: a determination unit configured to determine an interval ofthe distance that changes per unit time; and a selection unit configuredto select, when the interval is a second interval that is shorter than afirst interval, a filter that is suitable for processing of a signalhaving a higher frequency than that in the case of the first interval asthe filter to be used, from among the plurality of filters.
 4. The focusdetection apparatus according to claim 1, wherein the setting unit setsthe thinning rate to 1/T, where T is the number of lines required forthe processing by the filter.
 5. The focus detection apparatus accordingto claim 1, wherein the setting unit sets the thinning rate toM/(T×R×C), where T is the number of lines required for the processing bythe filter, M is a memory capacity of the storage unit configured tostore the read image signals, R is the number of pixels in the detectionarea in the sub-scanning direction, and C is the number of pixels in thedetection area in the main-scanning direction.
 6. The focus detectionapparatus according to claim 1, wherein the control unit performsprocessing with respect to the entire detection area while shifting aline to be processed.
 7. A method for controlling a focus detectionapparatus that is provided with an image sensor having a plurality ofpixels arranged two-dimensionally, and a plurality of filtersrespectively suitable for processing of signals having differentfrequencies for obtaining a focus state evaluation value in asub-scanning direction of the image sensor, the method comprising: asetting step of setting a thinning rate in a main-scanning direction ofthe image sensor depending on the filter to be used, of the plurality offilters; a reading step of sequentially reading, with the thinning rateset in the setting step, image signals from a detection area, on whichfocus control processing is performed, of areas of the plurality ofpixels, and storing the read image signals in a storage unit; aprocessing step of processing, each time image signals of the number oflines required for the processing by the filter to be used are stored inthe storage unit, the stored image signals with the filter to be usedand obtaining a focus state evaluation value; and a focus controlprocessing step of performing the focus control processing based on thefocus state evaluation value obtained in the processing step, wherein,if the filter to be used is suitable for processing of a signal having asecond frequency that is higher than a first frequency, the setting stepsets a thinning rate that is lower than that in the case where thefilter is suitable for processing of a signal having the firstfrequency.
 8. The method according to claim 7, further comprising: acomputation step of computing a focus state level based on an imagesignal obtained from the detection area; and a selection step ofselecting, when the computed focus state level is a second focus statelevel that is higher than a first focus state level, a filter that issuitable for processing of a signal having a higher frequency than thatin the case of the first focus state level as the filter to be used,from among the plurality of filters.
 9. The method according to claim 7,further comprising: a control step of performing control, while changinga distance between a focus lens and the image sensor, such that a focusstate evaluation value is obtained at each distance; a determinationstep of determining an interval of the distance that changes per unittime; and a selection step of selecting, when the interval is a secondinterval that is shorter than a first interval, a filter that issuitable for processing of a signal having a higher frequency than thatin the case of the first interval as the filter to be used, from amongthe plurality of filters.
 10. A focus detection apparatus comprising: acontrol unit configured to perform control such that image signals aresampled for each line of an image sensor and are sequentially stored ina storage unit, the image sensor having a plurality of pixels arrangedtwo-dimensionally; a plurality of filters respectively suitable forprocessing of signals having different frequencies for obtaining a focusstate evaluation value; a selection unit configured to select a filterto be used, from among the plurality of filters; and a processing unitconfigured to process the stored image signals with the selected filter,wherein the number of sampling of the image signals in the line that areto be stored in the storage unit varies depending on the selectedfilter.
 11. The focus detection apparatus according to claim 10, whereinthe control unit controls such that there is a smaller number ofsampling of image signals for each line, in the case where the filterthat is suitable for processing of a signal having a second frequencythat is lower than a first frequency is selected, than in the case wherethe filter that is suitable for processing of a signal having the firstfrequency is selected.
 12. The focus detection apparatus according toclaim 10, further comprising: a computation unit configured to compute afocus state level based on the image signal, wherein the selection unitselects, when the computed focus state level is a second focus statelevel that is higher than a first focus state level, a filter that issuitable for processing of a signal having a higher frequency than thatin the case of the first focus state level, from among the plurality offilters.
 13. The focus detection apparatus according to claim 10,wherein the processing unit processes, each time image signals of thenumber of lines required for the processing by the selected filter arestored in the storage unit, the stored image signals using the selectedfilter.
 14. The focus detection apparatus according to claim 13, whereinthe processing unit performs processing with respect to the entire areaon which the focus state detection processing is performed whileshifting a line to be processed.
 15. The focus detection apparatusaccording to claim 10, wherein the control unit samples, while changinga distance between a focus lens and the image sensor, an image signalthat corresponds to each distance, the focus detection apparatus furthercomprising, a determination unit configured to determine an interval ofthe distance that changes per unit time, wherein the selection unitselects, when the interval is a second interval that is shorter than afirst interval, a filter that is suitable for processing of a signalhaving a higher frequency than that in the case of the first interval,from among the plurality of filters.
 16. The focus detection apparatusaccording to claim 10, wherein the control unit sets the number ofsampling to 1/T, where T is the number of lines required for theprocessing by the filter.
 17. A focus detection method, comprising: acontrol step of performing control such that image signals are sampledfor each line of an image sensor, and are sequentially stored in astorage unit, the image sensor having a plurality of pixels arrangedtwo-dimensionally; a selection step of selecting a filter to be used,from among a plurality of filters respectively suitable for processingof signals having different frequencies for obtaining a focus stateevaluation value; and a processing step of processing the stored imagesignals with the selected filter, wherein the number of sampling of theimage signals in the line that are to be stored in the storage unitvaries depending on the selected filter.